package com.example.b_308.myapplication.service;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by tongkang on 2017/11/10.
 * 请求后台回调实体类
 */

public class OfficeResult {
    /**
     * 状态码
     */
    public int code;
    /**
     * 后台回调描述内容
     */
    public String message;

    /**
     * 后台回调对象
     */
    public String data;


    public OfficeResult(String json) {
        if (null != json)
            try {
                JSONObject jsonObject = new JSONObject(json);
                this.code = jsonObject.getInt("code");
                this.message = jsonObject.getString("message");
                this.data = jsonObject.getString("code");
            } catch (JSONException e) {
                this.code = OfficeContent.FAIL_BACK;
                this.message = OfficeContent.FAIL_BACK_MESSAGE;
            }
    }

    public OfficeResult(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }
}
